<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>获取页面可视区域宽高</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }

        body {
            width: 3000px;
            height: 3000px;
        }
    </style>
</head>
<body>
    
    <script type="text/javascript">
        console.log("页面可视区域宽", document.documentElement.clientWidth);
        console.log("页面可视区域高", document.documentElement.clientHeight);
        console.log("页面可视区域高 body", document.body.clientHeight);

        // window.innerWidth/Height 获取页面可视区域宽高，带滚动条的宽高
        console.log("window.innerWidth", window.innerWidth, "\nwindow.innerHeight", window.innerHeight);

        // window.outerWidth/Height 获取浏览器尺寸
        // window.screen.width/height 屏幕尺寸
        // window.screen.availWidth/Height 获取浏览器最大可视大小
        console.log(window.screen.width, window.screen.height);
        console.log(window.screen.availWidth, window.screen.availHeight);
    </script>
</body>
</html>